Authenticate User for Embedding with Window Authentication SSO

{ authenticateUserEmbedWindows }

Generates a Pyramid access authentication token for embedding using Windows Authentication tokens

Method

/API2/auth/authenticateUserEmbedWindows

  • API Section: /API2/auth
  • API Version: 2.0
  • From Release: 2018.5
  • Can be used by Non-admin accounts
  • Method operates via POST actions only.
  • Input Parameters

    Name

    domain

    Type

    string

    Description

    The URL web domain - needed only for embedded authentication.

    Output Response

    Successful Result Code

    200

    Description of Response Type

    The response is the security token as a base64 string. It is usually stored in a cookie.

    Notes

    The security token is a string that needs to be added to a cookie on the third party host page for any embedded content to ensure the access is authorized. The web browser must support Windows Authentication and the authentication METHOD must be set to 'Windows Authentication' in Pyramid.

    Examples
    Authenticate User for Embedding with Windows Authentication (JavaScript):

    This example demonstrates how to authenticate a user for embedding using Windows Authentication from JavaScript.

    Importantly, credentials must be "included" in the payload. Also, the hosting browser must support Windows Authentication; Pyramid must be using Active Directory as the authentication provider; and Windows Authentication must be the authentication method.

    // URL of the Pyramid installation and the path to the API 2.0 REST methods
    var pyramidURL = "http://mysite.com/api2/";
    
          function getAuthToken() {
            var URL = pyramidURL + "/auth/authenticateUserEmbedWindows";
            var credentials = {
              data: {
                domain: document.domain,
              },
            };
    
            fetch(URL, {
              method: "POST",
              credentials: "include",
              body: JSON.stringify(credentials),
            })
              .then((response) => response.text())
              .then((token) => console.log("fetch: " + token));
          }
    
          getAuthToken();